package cn.com.easyfelling.dao.impl;

import cn.com.easyfelling.dao.AccountDao;
import cn.com.easyfelling.entity.Account;
import cn.com.easyfelling.utils.DBUtilsBindThread;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Collections;
import java.util.List;

public class AccountDaoImpl  {


  public void updateAccount(int id,float money) {
    Connection conn = DBUtilsBindThread.getConnection();
    String sql = "update account set bal = bal + ? where id = ?";
    try (PreparedStatement preparedStatement = conn.prepareStatement(sql)){
      preparedStatement.setFloat(1,money);
      preparedStatement.setInt(2,id);
      int i = preparedStatement.executeUpdate();
      System.out.println("===根心结果==  "+i);
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }

}
